export default {
  created() {
    if (this.sidebarType) {
      this.$bus.$on("open_sidebar_" + this.sidebarType, this.handleViewThemeChange)
    } else {
      throw new Error("请设置data.sidebarType")
    }
  },
  beforeDestroy() {
    if (this.sidebarType) {
      this.$bus.$off("open_sidebar_" + this.sidebarType, this.handleViewThemeChange)
    }
  },
  methods: {
    handleViewThemeChange() {
      if (this.$refs.sidebar) {
        this.$refs.sidebar.show = true
        this.barShow?.()
      } else {
        throw new Error("请设置sidebar的ref")
      }
    }
  }
}
